Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add egg-pumpkin.json #425

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Commandcracker
Copy link
Contributor

@Commandcracker Commandcracker commented Dec 27, 2024

Description

Add egg for Pterodactyl

Testing

Please follow our Coding Guidelines

Copy link
Contributor

@Yimura Yimura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the installation script here to make it readable for everyone:

#!/bin/ash
set -eux

apk add --no-cache musl-dev git
mkdir -p /mnt/server

REPO_URL="${GIT_URL:-https://github.com/Snowiiii/Pumpkin.git}"

if [ -n "$GIT_BRANCH" ]; then
    git clone --depth 1 --single-branch --branch "$GIT_BRANCH" "$REPO_URL"
else
    git clone --depth 1 --single-branch "$REPO_URL"
fi

if [ -n "$GIT_COMMIT" ]; then
    git checkout "$GIT_COMMIT"
fi

cd Pumpkin

if [[ "$BUILD_RELEASE" == "1" || "$BUILD_RELEASE" == "true" ]]; then
    cargo build --release
    strip target/release/pumpkin
    cp target/release/pumpkin /mnt/server/pumpkin
else
    cargo build
    cp target/debug/pumpkin /mnt/server/pumpkin
fi

egg-pumpkin.json Show resolved Hide resolved
egg-pumpkin.json Outdated
},
"scripts": {
"installation": {
"script": "#!\/bin\/ash\r\nset -eux\r\n\r\napk add --no-cache musl-dev git\r\nmkdir -p \/mnt\/server\r\n\r\nREPO_URL=\"${GIT_URL:-https:\/\/github.com\/Snowiiii\/Pumpkin.git}\"\r\n\r\nif [ -n \"$GIT_BRANCH\" ]; then\r\n git clone --depth 1 --single-branch --branch \"$GIT_BRANCH\" \"$REPO_URL\"\r\nelse\r\n git clone --depth 1 --single-branch \"$REPO_URL\"\r\nfi\r\n\r\nif [ -n \"$GIT_COMMIT\" ]; then\r\n git checkout \"$GIT_COMMIT\"\r\nfi\r\n\r\ncd Pumpkin\r\n\r\nif [[ \"$BUILD_RELEASE\" == \"1\" || \"$BUILD_RELEASE\" == \"true\" ]]; then\r\n cargo build --release\r\n strip target\/release\/pumpkin\r\n cp target\/release\/pumpkin \/mnt\/server\/pumpkin\r\nelse\r\n cargo build\r\n cp target\/debug\/pumpkin \/mnt\/server\/pumpkin\r\nfi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cargo build command will build a generic image, since this will most likely be deployed on server with one specific set of hardware we can add additional instructions to optimize for this server's hardware. Through setting the following environment variables:

RUSTFLAGS="-C target-feature=-crt-static -C target-cpu=native"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to tweak the images a bit

Error loading shared library libgcc_s.so.1: No such file or directory (needed by ./pumpkin)
Error relocating ./pumpkin: _Unwind_Resume: symbol not found
Error relocating ./pumpkin: _Unwind_GetTextRelBase: symbol not found
Error relocating ./pumpkin: _Unwind_GetIPInfo: symbol not found
Error relocating ./pumpkin: _Unwind_GetIP: symbol not found
Error relocating ./pumpkin: _Unwind_SetGR: symbol not found
Error relocating ./pumpkin: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating ./pumpkin: _Unwind_Backtrace: symbol not found
Error relocating ./pumpkin: _Unwind_GetRegionStart: symbol not found
Error relocating ./pumpkin: _Unwind_SetIP: symbol not found
Error relocating ./pumpkin: _Unwind_RaiseException: symbol not found
Error relocating ./pumpkin: _Unwind_GetDataRelBase: symbol not found
Error relocating ./pumpkin: _Unwind_DeleteException: symbol not found

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I was honestly wondering on if the pumpkin executable could run without libgcc. I guess this answers that.

What we'd need to do is provide our own runtime container with libgcc installed. I had done that in my own repository for a pumpkin egg however I didn't bother building an ARM64 variant. Which the alpine yolk has.

@Snowiiii would you be fine with adding another container image for Pumpkin to run on Pterodactyl?
Probably tagged along the lines of ghcr.io/snowiiii/pumpkin:yolk.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as of my understanding, We then have 2 images. One without libgcc, And one with libgcc packaged ?. Isn't there a way to just install libgcc in the script ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At best 3 images

  1. normal pumpkin on alpine
  2. yolk based on ghcr.io/pterodactyl/yolks:alpine
  3. installer based on ghcr.io/pterodactyl/installers:alpine

(and maybe add a scratch and Debian image later on)

egg-pumpkin.json Outdated Show resolved Hide resolved
@Yimura
Copy link
Contributor

Yimura commented Dec 27, 2024

What have you done exactly to test it? I don't see anything specified in regards to that.

Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

@Commandcracker
Copy link
Contributor Author

What have you done exactly to test it? I don't see anything specified in regards to that.

Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

egg-pumpkin.json Outdated Show resolved Hide resolved
@Yimura
Copy link
Contributor

Yimura commented Dec 28, 2024

Ran into the following issue after setting the CARGO_BUILD_JOBS environment value to a number and then emptying out the field.
image

error: could not parse ``. Number of parallel jobs should be `default` or a number.

You may need to setup better fallbacks with the following scripting syntax:

# takes CARGO_BUILD_JOBS env variable, if empty assigns "default".
CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-default}

Edit:
This seems to be an issue with a fresh install as well, better default will probably prevent this.

@DataM0del
Copy link
Contributor

What have you done exactly to test it? I don't see anything specified in regards to that.
Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

Windows (dies inside)

@Commandcracker
Copy link
Contributor Author

What have you done exactly to test it? I don't see anything specified in regards to that.
Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

I ran it on Windows 11 WSL Debian bookworm.

Windows (dies inside)

Need to play league of legends and I don't want to clutter my Debian server. I also have a dual boot with fedora, but I have not used it for a while.

@RusticCraftsman
Copy link

What have you done exactly to test it? I don't see anything specified in regards to that.

Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

This is in docker's nature, because its repeatable and not reproducible, there is no way around this while using docker, i suggest we at least test it on macos, linux and windows before pushing this into master

@Commandcracker
Copy link
Contributor Author

What have you done exactly to test it? I don't see anything specified in regards to that.
Even though docker is supposed to allow for one and the same environment to be replicate able across machines, I've found out that this may not always be the case.

This is in docker's nature, because its repeatable and not reproducible, there is no way around this while using docker, i suggest we at least test it on macos, linux and windows before pushing this into master

We don't need to because Pterodactyl only supports Linux, see https://pterodactyl.io/wings/1.0/installing.html#supported-systems

@Yimura
Copy link
Contributor

Yimura commented Dec 29, 2024

I've tested this on my server and as long as the installation memory set in your Pterodactyl wing to a sufficient high number 4GB is probably best. It'll install just fine from there.

@Commandcracker
Copy link
Contributor Author

2gb should be enough, that's why I added "Requires around 2GB RAM to build, adjust docker.installer_limits.memory in your wing accordingly!" to the desc.

Copy link
Contributor

@Yimura Yimura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this is ready to ship, haven't had the libgcc issues that @Commandcracker has experienced.

Only slightly confusing thing is that there's no feedback of the installation process having finished (though the install banner disappears in Pterodactyl).
So perhaps a small echo to mention that the install is finished is in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants